package day19;
import java.util.Scanner;
/**
 * 查找两个字符串a,b中的最长公共子串
 */

/**
 * abcdefghijklmnop
 * abcsafjklmnopqrstuvw
 *
 * jklmnop
 */
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String s1 = sc.next();
        if (s.length() >= s1.length()) {
            String temp = s;
            s = s1;
            s1 = temp;
        }
        int len  = s.length();
        for (int i = s.length(); i > 0; i--) {//字符串长度
            for (int j = 0; j <= s.length() - i; j++) {
                String temp = s.substring(j, i + j);
                if (s1.contains(temp)) {
                    //System.out.println(temp);
                    System.out.println(temp.length());
                    return;
                }
            }
        }
    }
}